<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <link rel="stylesheet" href="http://cdn.staticfile.org/cesium/1.69.0/Widgets/widgets.css">
    <link rel="stylesheet" href="../css//index.css">
</head>

<body>
    <div class="fun-menu">
        nc数据格式的风场
        <button onclick="windAdd()">添加风场</button>
        <button onclick="setOptions()">修改参数</button>
        <button onclick="show(true)">显示</button>
        <button onclick="show(false)">隐藏</button>
        <button onclick="destroy()">销毁</button>
    </div>
    <div id=cesiumContainer></div>

    <script src="http://cdn.staticfile.org/cesium/1.69.0/Cesium.js"></script>
    <script src="../libs/windy/netcdfjs.min.js"></script>
    <script src="../libs//windy/cesium-wind.min.js"></script>
    <script src="../libs/cpc/index.js"></script>
    <script>
        let windy = null;
        const map = new cpc.Map({
            container: "cesiumContainer",
            baseMaps: [
                "http://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetPurplishBlue/MapServer",
            ],
        });

        function windAdd() {
            cesiumWind = new CesiumWind("../datas/nc/demo.nc");
            map.add(cesiumWind);
        }
        function show(isShow) {
            cesiumWind.show = isShow;
        }
        function setOptions() {
            const option = {
                maxParticles: 64 * 64,
                particleHeight: 100.0,
                fadeOpacity: 0.996,
                dropRate: 0.003,
                dropRateBump: 0.01,
                speedFactor: 1.0,
                lineWidth: 14.0,
                particlesTextureSize: 64,
            };
            cesiumWind.updateOption(option);
        }
        function destroy() {
            if (windy) {
                map.remove(cesiumWind);
            }
        }
    </script>
</body>

</html>